<?php
    session_start();
    include "/opt/lampp/htdocs/dom/html/db.php";
    $user =@$_SESSION["user"];
    if(!isset($user)){
    header("Location:../../admin/login.html");
    }

    $password = @$_POST['password'];
    $toopassword = @$_POST['toopassword'];
    if(!isset($password) and !isset($toopassword)){
        die("密码或者再次输入密码不为空");
    }
        if($password != $toopassword){
        die("两次密码不一致");
    }

    $sql="update admin set passwd = '$password'where user ='$user'";
        $db = new DB();
        $result = $db->update($sql);
        if($result){

        echo "修改成功";
        }else
        echo "修改失败";

    
?>